package cn.basic.social.manager.handler.dingtalkhandler.internal;

import cn.basic.social.api.dingtalk.DingRequest;
import cn.basic.social.api.dingtalk.DingResponse;
import cn.basic.social.api.dingtalk.channel.internal.request.InternalGetUserAccessTokenRequest;
import cn.basic.social.api.dingtalk.channel.internal.response.InternalGetUserAccessTokenResponse;
import cn.basic.social.manager.config.ProviderConfig;
import cn.basic.social.manager.config.RedisCache;
import cn.basic.social.manager.handler.dingtalkhandler.ThirdpartDingService;
import cn.basic.social.manager.handler.login.LoginRequest;
import cn.basic.social.manager.handler.login.LoginResponse;
import cn.basic.social.manager.handler.login.LoginService;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName InternalGetUserAccessTokenServiceImpl
 * @Description 获取用户token请求
 * 文档地址：<a href="https://open.dingtalk.com/document/orgapp/obtain-user-token?spm=ding_open_doc.document.0.0.38e81a0dKnvhmy"></a>
 * @Author yk.zlf
 * @Date 2023/10/23 17:04
 */
@Slf4j
public class InternalGetUserAccessTokenServiceImpl<T extends DingResponse, E extends DingRequest> implements ThirdpartDingService, LoginService {

    @Override
    public DingResponse invoke(DingRequest dingRequest, ProviderConfig providerConfig, RedisCache redisCache) throws Exception {
        return null;
    }

    @Override
    public LoginResponse invokeLogin(LoginRequest request, ProviderConfig providerConfig, RedisCache redisCache) throws Exception {
        InternalGetUserAccessTokenRequest getUserAccessTokenRequest = new InternalGetUserAccessTokenRequest();
        getUserAccessTokenRequest.setCode(request.getCode());
        InternalGetUserAccessTokenResponse getUserAccessTokenResponse = (InternalGetUserAccessTokenResponse) this.invoke(getUserAccessTokenRequest, providerConfig, redisCache);

        return null;
    }
}
